<?php

session_start();

require_once '../controllers/admin.guilds.class.php';
require_once '../engine/view.class.php';

$AdminGuilds = new AdminGuild;

if($_SESSION['admin'] == 1 OR $_SESSION['founder'] == 1) 
{
    $AdminGuilds -> messageGuilds();
    
    if( ! empty($_POST['delete']) AND $_POST['delete'] != "")
    {
	$AdminGuilds -> deleteGuild();
    }
    
    $AdminGuilds -> insertGuild();
    
    $AdminGuilds -> optionGuilds();
    $AdminGuilds -> optionAligns();

    $tags = array(
        'game-name' => $AdminGuilds::__GNAME,
        'options-guilds' => $AdminGuilds -> options_guilds, 
        'options-aligns' => $AdminGuilds -> options_aligns,
        'msg-box' => $AdminGuilds -> msg_box
    );

    $view = new view('../views/admin/a_guilds.view.html', $tags);
        $view -> show();
	
} else {

    $tags = array(
        'game-name' => $AdminGuilds::__GNAME, 
        'error' => '<div class="alert alert-danger">Accesso negato. Non si dispone di privilegi sufficienti.</div>'
    );
    
    $view = new view('style/error.template.html', $tags);
        $view -> show();
}

?>